import { type ICommand, type IAccessor, CommandType } from '@univerjs/core';
import { JnpfSheetsEchartService } from '../../services/sheet-echart.service';
import { JnpfCommandIds } from '../../utils/define';

export const JnpfSheetsInsertedEchartOperation: ICommand = {
  id: JnpfCommandIds.insertedEchart,
  type: CommandType.OPERATION,
  handler: async (_: IAccessor) => {
    return true;
  },
};

export const JnpfSheetsInsertBarEchartOperation: ICommand = {
  id: JnpfCommandIds.insertBarEchart,
  type: CommandType.OPERATION,
  handler: async (accessor: IAccessor) => {
    const jnpfSheetsEchartService = accessor.get(JnpfSheetsEchartService);
    jnpfSheetsEchartService.insertEchart('JnpfUniverBarEchart');

    return true;
  },
};

export const JnpfSheetsInsertLineEchartOperation: ICommand = {
  id: JnpfCommandIds.insertLineEchart,
  type: CommandType.OPERATION,
  handler: async (accessor: IAccessor) => {
    const jnpfSheetsEchartService = accessor.get(JnpfSheetsEchartService);
    jnpfSheetsEchartService.insertEchart('JnpfUniverLineEchart');

    return true;
  },
};

export const JnpfSheetsInsertPieEchartOperation: ICommand = {
  id: JnpfCommandIds.insertPieEchart,
  type: CommandType.OPERATION,
  handler: async (accessor: IAccessor) => {
    const jnpfSheetsEchartService = accessor.get(JnpfSheetsEchartService);
    jnpfSheetsEchartService.insertEchart('JnpfUniverPieEchart');

    return true;
  },
};

export const JnpfSheetsInsertRadarEchartOperation: ICommand = {
  id: JnpfCommandIds.insertRadarEchart,
  type: CommandType.OPERATION,
  handler: async (accessor: IAccessor) => {
    const jnpfSheetsEchartService = accessor.get(JnpfSheetsEchartService);
    jnpfSheetsEchartService.insertEchart('JnpfUniverRadarEchart');

    return true;
  },
};

export const JnpfSheetsFocusEchartOperation: ICommand = {
  id: JnpfCommandIds.focusEchart,
  type: CommandType.OPERATION,
  handler: async (_: IAccessor) => {
    return true;
  },
};
